package com.dotmedia.entities;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * Entity implementation class for Entity: User
 * 
 */
@Entity
@Table(name = "users")
public class User implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "users_id_sequence")
	@SequenceGenerator(name = "users_id_sequence", sequenceName = "users_id_sequence", allocationSize = 1)
	@Column(name = "user_id")
	private Integer id;

	@Column(name = "user_ext_id", unique = true, nullable = false)
	private String userExtId;

	@Column(name = "name")
	private String name;

	@Column(name = "surname")
	private String surname;

	@Column(name = "email")
	private String email;

	@Column(name = "password")
	private String password;

	@ManyToOne
	@JoinColumn(name = "role_id", referencedColumnName = "role_id")
	private Role role;

	@Column(name = "expire_on")
	private Date expireOn;

	@ManyToOne
	@JoinColumn(name = "lang_code", referencedColumnName = "lang_code")
	private UITranslations uiTranslation;

	@ManyToOne
	@JoinColumn(name = "system_id", referencedColumnName = "system_id")
	private SystemEntity system;

	public User() {
	}

	public User(String userExtId, String name, String surname, String email, String password, Role role, Date expireOn,
			UITranslations uiTranslations, SystemEntity system) {
		this.userExtId = userExtId;
		this.name = name;
		this.surname = surname;
		this.email = email;
		this.password = password;
		this.role = role;
		this.expireOn = expireOn;
		this.uiTranslation = uiTranslations;
		this.system = system;
	}

	public SystemEntity getSystem() {
		return system;
	}

	public void setSystem(SystemEntity system) {
		this.system = system;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUserExtId() {
		return userExtId;
	}

	public void setUserExtId(String userExtId) {
		this.userExtId = userExtId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSurname() {
		return surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}

	public Date getExpireOn() {
		return expireOn;
	}

	public void setExpireOn(Date expireOn) {
		this.expireOn = expireOn;
	}

	public UITranslations getUiTranslation() {
		return uiTranslation;
	}

	public void setUiTranslation(UITranslations uiTranslation) {
		this.uiTranslation = uiTranslation;
	}

}
